integer function str2label(str)
  use global_param,only:n_point_type
  use label_data_param,only:n_obj_type
  use label_data_param,only:obj_type
  implicit none
  
  interface
     function str2config(str)
       integer,pointer,dimension(:) :: str2config
       character :: str*(*)
     end function str2config
  end interface

  character :: str*(*)
  integer,pointer,dimension(:) :: p

  integer :: i,j
  integer :: len_str,foo

  str2label=0

  len_str=len_trim(str)
  if (len_str.eq.0) return

  p=>str2config(str)

  do i=1,n_obj_type
     foo=0
     do j=1,n_point_type
        if (obj_type(i)%config(j).eq.p(j)) then
           foo=foo+1
        else
           exit
        end if
     end do
     if (foo.eq.n_point_type) then
        str2label=i
        exit
     end if
  end do

  deallocate(p)

  return

end function str2label
